<?php

class tx_danplibs_flexform {
	
	
	function tx_danplibs_flexform() {
		
		
	}
	/**
	 * Generation of a simple Headline
	 * 
	 *
	 * @param	array		$PA: the parameter array for the current field
	 * @param	object		$fobj: Reference to the parent object
	 * @return	string		the HTML code for the field
	 */
	function flexFormHeadline($PA,$fobj) {
		//print_r($PA);
		$return ='';
		
		$tdClass=' class="bgColor5"';
		if ($PA['fieldConf']['config']['bgColor']==1)
			$tdClass=' class="bgColor2"';
		
		if ($PA['fieldConf']['config']['newTableRow']==1)
			$return='</td></tr><tr><td colspan="2" valign="top" '.$tdClass.'>';
		
		$value=$GLOBALS['LANG']->sl($PA['fieldConf']['config']['value']);
		if ($PA['fieldConf']['config']['strong']==1)
				$value ='<strong>'.$value.'</strong>';
		
		if ($PA['fieldConf']['config']['em']==1)
				$value ='<em>'.$value.'</em>';
		
		if ($PA['fieldConf']['config']['center']==1)
				$value ='<div style="text-align: center; width: 100%">'.$value.'</div>';
		
		
		
		return $return.$value;
	}
	
	
	function flexFormImage($PA,$fobj) {
		//print_r($PA);
		$tdClass=' class="bgColor5"';
		$return.='</td></tr><tr><td colspan="2" valign="top" '.$tdClass.'>';	
		
		
		if ($PA['fieldConf']['config']['useLLLSelector']==1)
			$image=$GLOBALS['LANG']->sl($PA['fieldConf']['config']['image']);
		else
			$image=$PA['fieldConf']['config']['image'];		
		
				
		
		
		
		$imageFile=t3lib_div::getFileAbsFileName($image);
		
	
		if (is_file($imageFile)) {
			$imageFile='../'.substr($imageFile,strlen(PATH_site));
			$return.='<img src="'.$imageFile.'">';
		}
		
		if ($PA['fieldConf']['config']['caption']!='')
			$return.='<div><em>'.$GLOBALS['LANG']->sl($PA['fieldConf']['config']['caption']).'</em></div>';
		return $return;
	}

}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/danp_libs/class.tx_danplibs_flexform.php'])    {
    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/danp_libs/class.tx_danplibs_flexform.php']);
}

php?>